﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Newtonsoft.Json.Linq;

namespace xbmc_json_async.Library
{
    /// <summary>
    /// Genre List
    /// </summary>
    public class Genres : List<Genre>
    {
        /// <summary>
        /// Loads from json object.
        /// </summary>
        /// <param name="jObject">The j object.</param>
        public bool LoadFromJsonObject(JObject jsonObject)
        {
            try
            {
                //
                if (jsonObject["genres"] != null)
                {
                    foreach (JObject item in (JArray)jsonObject["genres"])
                    {
                        base.Add(Genre.FromJsonObject(item));
                    }

                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
            }
        }

    }
}
